package com.xcl.mapper;

import com.xcl.pojo.Article;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {
    //查询所有数据
//    @Select("select * from article")
    public List<Article> findArticle(@Param("categoryId") Integer categoryId,@Param("state") String state);

    //删除
    @Delete("delete from article where id = #{id}")
    Integer deleteId(Integer id);

    //添加
    @Insert("insert into article(title,content,category_id,create_user,create_time,update_time,state) " +
    "values (#{title},#{content},#{categoryId},#{createUser},now(),now(),#{state})")
    public Integer addArticle(Article article);

    //修改文章
    @Update("update article set title=#{title},content=#{content},category_id=#{categoryId},update_time=now(),state=#{state} where id=#{id}")
    public Integer updateArticle(Article article);
}

